//
// Description: 189. 轮转数组
// Created by Loading on 2025/2/25.
//

#include <bits/stdc++.h>

using namespace std;

void rotate(vector<int> &nums, int k) {
    int n = nums.size();
    k = k % n;
    reverse(nums.begin(), nums.end());

    reverse(nums.begin(), nums.begin() + k);
    reverse(nums.begin() + k, nums.end());
}

int main() {
    vector<int> nums{1, 2, 3, 4, 5, 6, 7};
    int k = 11;
    rotate(nums, k);

    for (auto &x : nums) {
        cout << x << ' ';
    }
    cout << endl;

    return 0;
}